package io.gitee.hefren.hhcache.command;

import io.gitee.hefren.hhcache.core.*;

/**
 * @Date 2024/7/9
 * @Author lifei
 */
public class PingCommand implements Command {
    private static final String PONG = "PONG";
    @Override
    public String name() {
        return CommandEnum.PING.name();
    }

    @Override
    public Reply<?> exec(HhCache cache, String[] args) {
        String result = PONG;
        if (args.length >= 5) {
            result = getKey(args);
        }
        return Reply.bulkStringReply(result);
    }
}
